<?php    
    # Hae lihasryhmät
    $musclegroups = array_merge(
        array("" => "- Not selected -"),
        API::exerciseGetMuscleGroupList()
    );
        
    $now = time();
    $minus30days = strtotime("-30 days",$now);
?>

<div class="row">
    <div class="col-sm-2">
        <label for="trainingvolume-input-startdate">
            From
        </label>
    </div>
    <div class="col-sm-10">
        <div class="input-group date form_date" data-date-format="yyyy-mm-dd">
            <?php
                FT::input("startdate",date("Y-m-d",$minus30days),array(
                    "class"     => "form-control",
                    "id"        => "trainingvolume-input-startdate",
                    "maxlength" => 10,
                    "readonly"  => "readonly"
                ));
            ?>
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-th"></span>
            </span>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-sm-2">
        <label for="trainingvolume-input-enddate">
            To
        </label>
    </div>
    <div class="col-sm-10">
        <div class="input-group date form_date" data-date-format="yyyy-mm-dd">
            <?php
                FT::input("enddate",date("Y-m-d",$now),array(
                    "class"     => "form-control",
                    "id"        => "trainingvolume-input-enddate",
                    "maxlength" => 10,
                    "readonly"  => "readonly"
                ));
            ?>
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-th"></span>
            </span>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-sm-2">
        <label for="trainingvolume-select-musclegroup">
            Muscle group
        </label>
    </div>
    <div class="col-sm-10">
        <?php
            FT::select("musclegroup",$musclegroups,array(
                "class" => "form-control",
                "id"    => "trainingvolume-select-musclegroup"
            ));
        ?>
    </div>
</div>

<div class="row">
    <div class="col-sm-2">
        &nbsp;
    </div>
    <div class="col-sm-10">
        <?php
            FT::button("Get",array(
                "class"     => "btn trainingvolume-button btn-default",
                "id"        => "trainingvolume-button-get",
                "disabled"  => "disabled"
            ));
        ?>
    </div>
</div>

<div class="container" id="trainingvolume-div-data"></div>

<script type="text/javascript">
    $(".form_date").datetimepicker({
        autoclose:      1,
        minView:        2,
        todayBtn:       1,		
        todayHighlight: 1,
        weekStart:      1
    });
    
    getViewScript("trainingvolume",function(){
        viewTrainingvolume.initializePage();
        viewTrainingvolume.getData();
    });
</script>